package com.shuma.userservice.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "permission-service") // 服务名来自 permission-service 的 spring.application.name
public interface PermissionFeignClient {

    @PostMapping("/rpc/permission/bind-default-role")
    void bindDefaultRole(@RequestParam("userId") Long userId);

    @GetMapping("/rpc/permission/get-role-code")
    String getUserRoleCode(@RequestParam("userId") Long userId);

    @GetMapping("/rpc/permission/user-id-list-by-role")
    List<Long> getUserIdsByRole(@RequestParam("roleCode") String roleCode);

    @PostMapping("/rpc/permission/upgrade-admin")
    void upgradeToAdmin(@RequestParam("userId") Long userId);

    @PostMapping("/rpc/permission/downgrade-user")
    void downgradeToUser(@RequestParam("userId") Long userId);
}
